import http from '@/utils/http'
import type * as T from './type'


const BASE_URL = '/asset/part/category'


/** @desc 查询设备分类列表 */
export function listPartCategory(query: T.PartCategoryPageQuery) {
  return http.get<T.PartCategoryResp[]>(`${BASE_URL}/tree`, query)
}

/** @desc 查询设备分类详情 */
export function getPartCategory(id: string) {
  return http.get<T.PartCategoryDetailResp>(`${BASE_URL}/${id}`)
}

/** @desc 新增设备分类 */
export function addPartCategory(data: any) {
  return http.post(`${BASE_URL}`, data)
}

/** @desc 修改设备分类 */
export function updatePartCategory(data: any, id: string) {
  return http.put(`${BASE_URL}/${id}`, data)
}

/** @desc 删除设备分类 */
export function deletePartCategory(id: string) {
  return http.del(BASE_URL, { ids: [id] })
}

/** @desc 导出设备分类 */
export function exportPartCategory(query: T.PartCategoryQuery) {
  return http.download<any>(`${BASE_URL}/export`, query)
}
